
// 为函数的参数和返回值标注类型
function add( x: number , y: number ): number {
    return x + y ;
}

let result = add( 100 , 200 );
console.log( result );

function welcome( param:[number,string] ){
    console.log( param[ 0 ] , param[1] );
}

let p: [number,string] = [ 1001 , '小朱' ]; 

welcome( p );

function hello( student: { id?: number , name: string , age?: number } ){
    // 解构对象(实例级别)
    let { id = 1 , name , age = 16 } = student ;
    console.log( id , name , age );
}

let stu = {
    id: 1002,
    name: '马飞燕',
    age: 20 ,
    married: undefined
}

hello( stu );